package com.whfc.mach.dao;

import com.whfc.mach.dto.AppMachDTO;
import com.whfc.mach.dto.warn.MachWarnRuleDTO;
import com.whfc.mach.entity.AppMachWarnRuleObject;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface AppMachWarnRuleObjectMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(AppMachWarnRuleObject record);

    int insertSelective(AppMachWarnRuleObject record);

    AppMachWarnRuleObject selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(AppMachWarnRuleObject record);

    int updateByPrimaryKey(AppMachWarnRuleObject record);

    /**
     * 根据报警对象查找
     *
     * @param objectId
     * @return
     */
    List<MachWarnRuleDTO> selectByObjectId(@Param("objectId") String objectId);

    /**
     * 根据报警规则id查找
     *
     * @param ruleId
     * @return
     */
    List<String> selectByRuleId(@Param("ruleId") Integer ruleId);

    /**
     * 根据规则id查找
     *
     * @param ruleId
     * @return
     */
    List<AppMachDTO> selectMachByRuleId(@Param("ruleId") Integer ruleId);

    /**
     * 查找可供选择的设备
     *
     * @param deptId
     * @param ruleType
     * @return
     */
    List<AppMachDTO> selectAvailableMach(@Param("deptId") Integer deptId, @Param("ruleType") Integer ruleType);

    /**
     * 根据报警规则id删除
     *
     * @param ruleId
     */
    void deleteByRuleId(@Param("ruleId") Integer ruleId);

    /**
     * 批量添加
     *
     * @param list
     */
    void batchInsert(@Param("list") List<AppMachWarnRuleObject> list);
}